// TypeScript file
class RvoExample {
    private static _instance: RvoExample;
    public static getIt(): RvoExample {
        if (!this._instance) {
            this._instance = new RvoExample();
        }
        return this._instance;
    }

    private _curTime: number = 0;
    private _lastTime: number = 0;
    
    private _mapLayer: MapLayer;
    public constructor() {
        this._curTime = 0;
        this._lastTime = 0;
    }

    public test(): void {
        this._mapLayer = new MapLayer();
        egret.MainContext.instance.stage.addChild(this._mapLayer);

        egret.startTick(this.update, this);
    }

    public update(): boolean {
        this._curTime = egret.getTimer();
        let dt = this._curTime - this._lastTime;
        this._lastTime = this._curTime;

        this._mapLayer.update(dt);

        return false;
    }

    public getMapLayer(): MapLayer {
        return this._mapLayer;
    }
}